1. Field of the Invention
The present invention relates to a method for correcting lightness of an image, which provides a desired, optimum dynamic range to a digital still color picture that has been captured by a digital camera, a monitoring camera, etc.
2. Description of the Related Art
As a method for correcting lightness information, color information, etc., of a digital still color image, a retinex method taking a retina of an eyeball as a model is proposed, in which a lightness value of an image with a biased dynamic range (dynamic characteristic) is corrected based on local information of the image. In such a retinex method, the quality of an image can be improved by correcting a low lightness value resulting in a darker portion in the image to a high lightness value, and a high lightness value resulting in a brighter portion in the image to a low lightness value.
As examples of such a retinex method, the single scale retinex method (Daniel J, Jobson, et al., xe2x80x9cProperties and Performance of a Center/Surround Retinex,xe2x80x9d IEEE Trans. on Image Processing vol.6, pp.451-462, March 1997) and the multiscale retinex method (Daniel J, Jobson, et al., xe2x80x9cA Multiscale Retinex for Bridging the Gap Between Color Image and the Human Observation of Scenes,xe2x80x9d IEEE Trans. on Image Processing vol.6, pp.956-976, July 1997) are proposed.
In the single scale retinex method, a spectrum component Ii(x,y) (i=1, 2, . . . ) of a subject pixel I(x,y) in an original image is corrected by a surround function F(x,y) obtained from image information of the surround pixels. The result Ri of retinex processing is represented by expression (1):
Ri=log(Ii(x,y))xe2x88x92log[F(x,y)*Ii(x,y)]xe2x80x83xe2x80x83. . . (1)
where xe2x80x9c*xe2x80x9d denotes a convolution operator.
In this case, the surround function F(x,y) is a function which is based on the image information of the surround pixels with respect to the subject pixel I(x,y), which is represented by expression (2):
xe2x80x83F(x,y)=Kexe2x88x92r2/c2xe2x80x83xe2x80x83. . . (2)
where r denotes a distance (r2 =X2 +y2) between the subject pixel and the surround pixel, and c is a scaling variable. Furthermore, K is a scalar coefficient, which is set so that ∫∫F(x,y)dxdy=1 is satisfied, i.e., the total value of the surround function is 1.
After the result Ri (x,y) of the single scale retinex processing has been obtained, the result Ri (x,y) is corrected with a gain correction value Ag and an offset correction value Ao, and extended to conform to an appropriate dynamic range. A result of the correction retinex processing, IRi, is represented by expression (3):
IRi =Agxc3x97Ri+Aoxe2x80x83xe2x80x83. . . (3)
As described above, in the single scale retinex method, the spectrum band components of the subject pixel are retinex-processed based on the surround function. On the other hand, in the color restoration multiscale retinex (MSR) method, each of the spectrum band components, Ii, of the subject pixel is retinex-processed by N types of scales. In this case, the result of the single retinex process for each of the N scales is multiplied by a weighting factor xcfx89n, and the multiscale results with respect to all the scales are totaled. The result of the multiscale retinex (MSR) processing, RMSRi, is represented by expression (4):                               R                      MSR            i                          =                              ∑                          n              =              1                        N                    ⁢                      xe2x80x83                    ⁢                                    ω              n                        ⁢                          R                              n                i                                                                        (        4        )            
The result of the MSR processing, RMSRi, which has been obtained by expression (4), is then corrected with a color correction coefficient Ci(x,y) that is represented by expression (5):                                           C            i                    ⁡                      (                          x              ,              y                        )                          =                  β          ⁢                      {                                          log                ⁡                                  [                                                            αI                      i                                        ⁡                                          (                                              x                        ,                        y                                            )                                                        ]                                            -                              log                ⁡                                  [                                                            ∑                                              i                        =                        1                                            S                                        ⁢                                          xe2x80x83                                        ⁢                                                                  I                        i                                            ⁡                                              (                                                  x                          ,                          y                                                )                                                                              ]                                                      }                                              (        5        )            
The result of the MSR processing, RMSRi, obtained by expression (4) is corrected by the color correction coefficient Ci(x,y) of expression (5), thereby obtaining the result of the color correction multiscale retinex processing, RMSRCRi(x,y), as shown in expression (6):
xe2x80x83RMSRCRi (x,y)=CI (x,y)xc2x7RMSRi (x,y)xe2x80x83xe2x80x83. . . (6)
The result of the color correction multiscale retinex processing, RMSRCRi(x,y), is corrected, as described as to the single scale retinex method, with the gain correction value Ag and the offset correction value Ao which are correction parameters, and extended to conform to an appropriate dynamic range. A result of the final color correction multiscale retinex processing, IMSRCRi, is represented by expression (7):
IMSRCRi=Agxc3x97RMSRCRi+Aoxe2x80x83xe2x80x83. . . (7)
In the color correction multiscale retinex method, an original image is generally single scale retinex processed with respect to three scales (small, medium, and large scales), whereby corrected images corresponding to the respective scales are obtained. These corrected images are synthesized to obtain an image with corrected lightness and color. In the small scale, a distance between a subject pixel and a surround pixel (the radius of the small scale) is relatively short, whereas in the large scale, a distance between a subject pixel and a surround pixel (the radius of the large scale) is relatively long. In the medium scale, a distance between the subject pixel and a surround pixel (the radius of the medium scale) is set to a length intermediate between that of the small scale and that of the large scale.
In each of the small, medium, and large scales, the scale size thereof is fixed, and is not an appropriate size for making a desirable correction. Accordingly, a correction result widely varies in accordance with the size or color of an original image to be corrected, whereby a sufficient correction effect may not be obtained. Especially in the case where the size of an image is large, if the scale size of the small scale is fixed at a small size, a noise may be generated in a corrected image.
Furthermore, the correction parameters shown in expression (7), i.e., the gain correction value Ag and the offset correction value Ao, are fixed values. With such parameters, in some images, the lightness of pixels may not be corrected so as to conform to an appropriate dynamic range.
Thus, with the conventional color correction multiscale retinex method, sufficient flexibility in correcting images cannot be obtained, and some images may not be corrected appropriately. Therefore, the conventional color correction multiscale retinex method is less than satisfactory as a method for correcting the lightness of images.
According to one aspect of the present invention, the method for correcting lightness of an image includes the steps of: calculating a first scale and a second scale based on an image scale of an original image from image information of the original image; multiscale retinex processing the original image with respect to the first scale and the second scale; and synthesizing a result of the multiscale retinex processing with the image information of the original image.
In one embodiment of the present invention, the method for correcting lightness of an image further includes the step of correcting the result of the multiscale retinex processing based on a gain correction value and an offset correction value.
In another embodiment of the present invention, the offset correction value is corrected based on a histogram of a lightness value against the number of pixels of the original image.
In still another embodiment of the present invention, the first scale is a small scale, and the second scale is a large scale.
In still another embodiment of the present invention, a radius of the large scale is about xc2xd of a longer side of the original image.
In still another embodiment of the present invention, a radius of the small scale is about ⅕ of a longer side of the original image.
According to another aspect of the present invention, the image processing device includes: a scale size calculating section for calculating a first scale and a second scale based on an image scale of an original image from image information of the original image; and a scale retinex processing section for multiscale retinex processing the original image with respect to the first scale and the second scale, wherein a result of the multiscale retinex processing is synthesized with the image information, thereby generating an output image.
In one embodiment of the present invention, the result of the multiscale retinex processing is corrected based on a gain correction value and an offset correction value.
In another embodiment of the present invention, the offset correction value is corrected based on a histogram of the lightness value against the number of pixels of the original image.
In still another embodiment of the present invention, the first scale is a small scale, and the second scale is a large scale.
In still another embodiment of the present invention, a radius of the large scale is about xc2xd of a longer side of the original image.
In still another embodiment of the present invention, a radius of the small scale is about ⅕ of a longer side of the original image.
Thus, the invention described herein makes possible the advantages of (1) providing a method for correcting the lightness of images, by which an appropriate dynamic range conformable to the size of the images can be obtained, and (2) providing an image processing device using such a correction method.
These and other advantages of the present invention will become apparent to those skilled in the art upon reading and understanding the following detailed description with reference to the accompanying figures.